<template>
  <span style="line-height: 28px;">
    <a-tag v-for="(item, index) in titleArray" :key="index" :visible="true">
      {{item}}
    </a-tag>
  </span>
</template>
<script>
export default {
  components: {
  },
  props: {
    data: {
      type: [Object, Array], // Map类型：{k1: '', k2: '', ...}，List类型：[{..., name: ''}, ...]
      default: () => {
        return []
      }
    }
  },
  data() {
    return {
      titleString: '',
      titleArray: []
    }
  },
  mounted() {
    this.init()
  },
  watch: {
    data() {
      this.init()
    },
  },
  methods: {
    init() {
      const titleArray = []
      if (this.data && this.data.length) {
        for (let row of this.data) {
          titleArray.push(row.name)
        }
      } else {
        for (let k in this.data) {
          titleArray.push(this.data[k])
        }
      }
      this.titleArray = titleArray
    },
  }
}
</script>
